//
//  UINavigationController+HKLeak.m
//  HKUtilities
//
//  Created by 胡锦涛 on 2018/11/3.
//  Copyright © 2018 胡锦涛. All rights reserved.
//

#import "UINavigationController+HKLeak.h"
#import "NSObject+HKSwizzling.h"
#import "UIViewController+HKLeak.h"
#import <objc/runtime.h>
@implementation UINavigationController (HKLeak)
/**
 * 1.交换方法
 */
+(void)load {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        [self swizzleSEL:@selector(popViewControllerAnimated:) withSEL:@selector(leak_popViewControllerAnimated:)];
    });
}

- (UIViewController *)leak_popViewControllerAnimated:(BOOL)animated {
    UIViewController * popVC = [self leak_popViewControllerAnimated:animated];
    objc_setAssociatedObject(popVC, HKVCFLAG, @(YES), OBJC_ASSOCIATION_ASSIGN);
    return popVC;
}
@end
